package com.cloudsigns.factorymanager2.engineering.presenter;

import com.cloudsigns.factorymanager2.engineering.IView.IEngineeringConstructOrderDetailView;
import com.cloudsigns.factorymanager2.engineering.IView.IEngineeringInstallDailyFeedbackConfirmView;
import com.cloudsigns.factorymanager2.engineering.bean.EngineeringConstructOrderBean;
import com.cloudsigns.factorymanager2.engineering.model.EngineeringConstructOrderDetailModel;
import com.cloudsigns.factorymanager2.engineering.model.EngineeringInstallDailyFeedbackConfirmModel;
import com.cloudsigns.factorymanager2.engineering.model.IEngineeringConstructOrderDetailModel;
import com.cloudsigns.factorymanager2.engineering.model.IEngineeringInstallDailyFeedbackConfirmModel;

/**
 * Created by tony on 2018/5/26.
 */

public class EngineeringInstallDailyFeedbackConfirmPresenter {
    private IEngineeringInstallDailyFeedbackConfirmView view;
    private IEngineeringInstallDailyFeedbackConfirmModel model;
    private android.os.Handler mHandler = new android.os.Handler();

    public EngineeringInstallDailyFeedbackConfirmPresenter(IEngineeringInstallDailyFeedbackConfirmView view) {
        this.view = view;
        this.model = new EngineeringInstallDailyFeedbackConfirmModel();
    }

    public void engineeringIstallDailyFeedbackConfirm() {


        model.engineeringIstallDailyFeedbackConfirm(view.getcontent(), view.getDailyFeedbackId(), view.getOrderId(), view.getType(), new EngineeringInstallDailyFeedbackConfirmModel.OnEngineeringIstallDailyFeedbackConfirmListener() {
            @Override
            public void engineeringIstallDailyFeedbackSuccessed() {
                //需要在UI线程执行
                mHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        view.feeedbackSuccessed();
                        view.hideLoading();
                    }
                });
            }

            @Override
            public void engineeringIstallDailyFeedbackFailed(final String desc) {
                mHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        view.showFailedError(desc);
                        view.hideLoading();
                    }
                });
            }


        });
    }
}
